﻿<!DOCTYPE html>
<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>fexigrid_</title>
		<!-- 样式表 -->
		<link rel="stylesheet" href="body_style.css" />
		<link rel="stylesheet" type="text/css" href="css/flexigrid/flexigrid.css">
		<style type="text/css">
				.flexigrid div.fbutton .add
					{
					/* //（添加）按钮图像 */
						background: url(css/images/add.png) no-repeat center left;
					}	

				.flexigrid div.fbutton .delete
					{/* //（delete）按钮图像 */
						background: url(css/images/close.png) no-repeat center left;
					}	
		</style>
		<!-- 脚本 -->
		<script type="text/javascript" src="lib/jquery/jquery.js"></script>
		<script type="text/javascript" src="flexigrid.js"></script>
</head>

<body>


<table id="flex1" style="display:none"></table>

<script type="text/javascript">

       $(function () {
            $("#flex1").flexigrid({
               url: 'myjson/json2.txt',
                dataType: 'json',
                colModel: [
							{ display: '优惠券状态',	name: 'couStat',	width: 100, sortable: true, align: 'left' },	
							{ display: '手机号',		name: 'phone',		width: 100, sortable: true, align: 'left' },
							{ display: '使用日期',	name: 'writeOff',	width: 100, sortable: true, align: 'left' },
							{ display: '核销成员',	name: 'useLeag',	width: 100, sortable: true, align: 'left' },
							{ display: '过期日期',		name: 'ended',		width: 100, sortable: true, align: 'left' },
							{ display: '发放网点',	name: 'dealOrg',	width: 100, sortable: true, align: 'left' },
							{ display: '优惠券号',		name: 'couId',		width: 100, sortable: true, align: 'left' },
							{ display: '发行成员',	name: 'applyOrg',	width: 100, sortable: true, align: 'left' },
							{ display: '核销网点',	name: 'useOrg',		width: 100, sortable: true, align: 'left' },
							{ display: '优惠券金额/折扣',	name: 'discount',	width: 100, sortable: true, align: 'left' },
							{ display: '发放操作员',	name: 'dealUser',	width: 100, sortable: true, align: 'left' },
							{ display: '会员卡号',		name: 'crdId',		width: 100, sortable: true, align: 'left' },
							{ display: '会员姓名',	name: 'realName',	width: 100, sortable: true, align: 'left' },
							{ display: 'started',	name: 'started',	width: 100, sortable: true, align: 'left' },
							{ display: '优惠券类型',	name: 'rulType',	width: 100, sortable: true, align: 'left' },
							],
                buttons: [
		        { name: 'Add', bclass: 'add', onpress: test },
		        { name: 'Delete', bclass: 'delete', onpress: test },
		        { separator: true }
		        ],
                searchitems: [
		        { display: '名称', name: 'Name' },
		        { display: '描述', name: 'Description', isdefault: true }
		        ],
                sortname: "couStat",
                sortorder: "asc",
				width:'100%',

                usepager: true,
                title: '会员报表',
                useRp: true,
                rp: 15,
                showTableToggleBtn: true,
                pagestat: "显示{from}到{to}记录，总记录数:{total}",
                procmsg: '正在加载数据，请稍后...', 
                preProcess: preProcessData
            });
            function test(com, grid) {
                if (com == 'Delete') {
                    confirm('Delete ' + $('.trSelected', grid).length + ' items?')
                } else if (com == 'Add') {
                    alert('Add New Item');
                }
            }
            function preProcessData(data) {
                console.log(data);
                return data;
            }
          
        });

</script>
</body>
</html>